package com.hxzy.service;

/**
 * redis令牌业务逻辑
 */
public interface TokenService<T> {

    /**
     * https://www.bchrt.com/tools/rsa/ 网上生成
     * JAVA后端生成令牌用的密码
     */
    String ADMIN_SINGATURE="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA68QpG534qOo6SpQh06F1l7j7Jef2NMV+aAuPJFP62SL/M8OKM0sfw7bZPlEhYP2WBwEPghURbJ4vWJ3HN+sshffuqOROyWZqH06e0yt9gW68y/m3JODjXluzRemiIBcsEINXbew4Mji/o52hAJgdVkX0KeNbpfQCDmvz4idejoWO2xw54IQlgJnXOP8gm+AGvNrsCjH5JeukFSBVcnWzqy9RQWbJRy2YV9/FV+uOCrxUinzrbODsYxTgYPV6xzDFD6TqQWHTGfIDjyEplRQEHgSJ/R4GGBnx3JiP2qQfHCkQGJDrbnXm1iCoyBlDQ9OvwlFv2qmzY9QLdlnzuCpSpwIDAQAB";

    /**
     * 手机端(微信，小程序，uni-app)密钥
     */
    String MBOILE_SINGATURE="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt7/IdcCNr8kOgTzxGYv0wZFybVqKsQODgvalnRmKbRCHoSfkREVhSIBP7M7Wt3kbaqu0BmqViw3e0xH1P0W5+V03LBEx/6b2EM47tYpTlu2AEeKk2ZYb25cPn0IXVgVkgSlbMplWE65g+Ox8bDkLLrPn8wUh+5LvThfq9uwQiqIytNvJyxyIZWpaKk0Z5S5WGkYmzR6Wf0yWVj0LkMpR+G2tUG9FySml/71hoag2HQh2xL64vncnKdFr8tPGZzTD1PrxbsCZlrQyTPm2vcQ2H/BtRAI9F6WlxItNgdHPP+aJgSzqMtiqdHRUk/ucfEjV7wQsQDDqm9EUerqN+t5JnQIDAQAB";

    /**
     * 管理员或商家令牌redis存储过期时间
     */
    long ADMIN_TOKEN_EXPIRED_MINUTES=60L;

    /**
     * 创建令牌(把对象存储到redis中，并返回令牌字符串)
     * @param entity
     * @return
     */
    String createToken(T entity);

    /**
     * 把数据存储到redis中
     *
     * @param entity 登录信息
     */
    void refreshToken(T entity);


    /**
     * 根据jwt令牌从redis中获取用户身份信息
     *
     * @return 用户信息
     */
    T getLoginResp(String jwtToken);

    /**
     * 退出
     */
    void logout();


}
